package com.java.grammer.arrays; /**
 * @Description
 * @author xiaoqi   Email:1404899001@qq.com
 * @version
 * @date 2020-11-1216:29:43
 * <p>
 * 数组练习：
 * 1.输入随机个数个学生
 * 2.输入随机个数的成绩
 * 3.输出成绩最高者
 * 4.输出每个学生的成绩、分数和等级
 */

/**
 * @Description
 * @author xiaoqi   Email:1404899001@qq.com
 * @version
 * @date 2020-11-1216:29:43
 *
 * 数组练习：
 * 1.输入随机个数个学生
 * 2.输入随机个数的成绩
 * 3.输出成绩最高者
 * 4.输出每个学生的成绩、分数和等级
 */

import java.util.Scanner;

public class Array_Exer1 {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入学生人数");
        int num = sc.nextInt();
        int[] scores = new int[num];
        System.out.println("请输入" + num + "个学生成绩");
        for (int i = 0; i < scores.length; i++) {
            scores[i] = sc.nextInt();
        }
        int maxScores = 0;
        for (int i = 0; i < scores.length; i++) {
            if (scores[i] > maxScores) {
                maxScores = scores[i];
            }
        }
        System.out.println("最大值为：" + maxScores);
        char level;
        for (int i = 0; i < scores.length; i++) {
            if (maxScores - scores[i] <= 10) {
                level = 'A';
            } else if (maxScores - scores[i] <= 20) {
                level = 'B';
            } else if (maxScores - scores[i] <= 30) {
                level = 'C';
            } else {
                level = 'D';
            }
            System.out.println("student:" + i + "scores:" + scores[i] + "grade is" + level);
        }

    }
}
